package nezumi.state;

import java.awt.Point;
import nezumi.Constants;
import nezumi.planning.Planner;

public class State {

	private final MapState mapState;
	private final AgentState agentState;
	private final SensorState sensorState;
	private final TargetState targetState;
	private final Planner planner;

	public State() {

		this.planner = new Planner(this,
				new Point((int) (Constants.MAP_WIDTH
						/ Constants.MAP_GRANULARITY / 2 + 1),
						(int) (Constants.MAP_HEIGHT / Constants.MAP_GRANULARITY
								/ 2 + 1)));
		this.agentState = new AgentState(this, new Point(
				(int) (Constants.MAP_WIDTH / Constants.MAP_GRANULARITY),
				(int) (Constants.MAP_HEIGHT / Constants.MAP_GRANULARITY)),
				Math.PI);
		this.mapState = new MapState(this, (int) (Constants.MAP_WIDTH
				/ Constants.MAP_GRANULARITY * 2), (int) (Constants.MAP_HEIGHT
				/ Constants.MAP_GRANULARITY * 2));
		this.targetState = new TargetState(this, (int) (Constants.MAP_WIDTH
				/ Constants.MAP_GRANULARITY * 2), (int) (Constants.MAP_HEIGHT
				/ Constants.MAP_GRANULARITY * 2), Constants.N_TARGETS);
		this.sensorState = new SensorState(this);
		this.sensorState.addObserver(mapState);
		this.sensorState.addObserver(targetState);
	}

	public MapState getMapState() {
		return mapState;
	}

	public AgentState getAgentState() {
		return agentState;
	}

	public SensorState getSensorState() {
		return sensorState;
	}

	public TargetState getTargetState() {
		return targetState;
	}

	public Planner getPlanner() {
		return planner;
	}
}
